\defmodule {ExponentialGen}

This class implements random variate generators for the 
{\em exponential\/} distribution. The density is
\eq
  f(x) = \lambda e^{-\lambda x} \qquad\mbox{ for }x\ge 0,
\endeq
where $\lambda > 0$.

The (non-static) \texttt{nextDouble} method simply calls \texttt{inverseF} on the
distribution. 

\bigskip\hrule

\begin{code}
\begin{hide}
/*
 * Class:        ExponentialGen
 * Description:  random variate generators for the exponential distribution
 * Environment:  Java
 * Software:     SSJ 
 * Copyright (C) 2001  Pierre L'Ecuyer and Universite de Montreal
 * Organization: DIRO, Universite de Montreal
 * @author       
 * @since

 * SSJ is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License (GPL) as published by the
 * Free Software Foundation, either version 3 of the License, or
 * any later version.

 * SSJ is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * A copy of the GNU General Public License is available at
   <a href="http://www.gnu.org/licenses">GPL licence site</a>.
 */
\end{hide}
package umontreal.iro.lecuyer.randvar;\begin{hide}
import umontreal.iro.lecuyer.rng.*;
import umontreal.iro.lecuyer.probdist.*;
\end{hide}

public class ExponentialGen extends RandomVariateGen \begin{hide} {
   protected double lambda; 

\end{hide}\end{code}

\subsubsection* {Constructors}
\begin{code}

   public ExponentialGen (RandomStream s, double lambda) \begin{hide} {
      super (s, new ExponentialDist(lambda));
      setParams (lambda);
   }\end{hide}
\end{code} 
\begin{tabb} Creates an exponential random variate generator with
 parameter $\lambda $ = \texttt{lambda}, using stream \texttt{s}. 
\end{tabb}
\begin{code}

   public ExponentialGen (RandomStream s, ExponentialDist dist) \begin{hide} {
      super (s, dist);
      if (dist != null)
         setParams (dist.getLambda());
   } \end{hide}
\end{code}
 \begin{tabb}  Creates a new generator for the exponential 
   distribution \texttt{dist} and stream \texttt{s}.   
 \end{tabb}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
\subsubsection* {Methods}
\begin{code}
   
   public static double nextDouble (RandomStream s, double lambda) \begin{hide} {
      return ExponentialDist.inverseF (lambda, s.nextDouble());
   }\end{hide}
\end{code}
 \begin{tabb}  Uses inversion to generate a new exponential variate
   with parameter $\lambda = $~\texttt{lambda}, using stream \texttt{s}.
 \end{tabb}
\begin{code}

   public double getLambda()\begin{hide} {
      return lambda;
   }
\end{hide}
\end{code}
\begin{tabb}
   Returns the $\lambda$ associated with this object.
\end{tabb}
\begin{hide}\begin{code}

   protected void setParams (double lam) {
      if (lam <= 0.0)
         throw new IllegalArgumentException ("lambda <= 0");
      this.lambda = lam;
   }
\end{code}
\begin{tabb} Sets the parameter $\lambda = $ \texttt{lam} of this object.
\end{tabb}
\begin{code}
}\end{code}
\end{hide}
